const axios = require("axios")
// const baseUrl = "http://musicapi.leanapp.cn"
// var baseUrl = "https://autumnfish.cn"
// const baseUrl = "http://www.yemengs.cn"
const baseUrl = "http://localhost:3000"
const instance = axios.create({
    // baseURL: process.env.BASE_API, // node环境的不同，对应不同的baseURL
    // withCredentials: true // 允许携带cookie  
});
instance.interceptors.response.use(res => res.data);

export default function (obj) {
    let { url, method, data } = obj
    url = baseUrl + url
    if (method == "get") {
        return instance.get(url, { params: data })
    } else {
        return instance.post(url, data)
    }
}